package 力扣._48_旋转图像;

public class Solution {
    public void rotate(int[][] matrix) {
        int len = matrix.length;
        for (int i = 0; i < len / 2; i++) {
            //从外向内第i环
            int j = len - 2 * i;
            for (int k = 0; k < j - 1; k++) {
                int t = matrix[len - 1 - i - k][i];
                matrix[len - 1 - i - k][i] = matrix[len - 1 - i][len - 1 - i - k];
                matrix[len - 1 - i][len - 1 - i - k] = matrix[i + k][len - 1 - i];
                matrix[i + k][len - 1 - i] = matrix[i][i + k];
                matrix[i][i + k] = t;
            }
        }
    }

    public static void main(String[] args) {

    }
}
